//对外暴露配置路由(常量路由):全部用户都可以访问到的路由
import { mallRoute } from '@/router/mall.ts'
import { forumRoute } from '@/router/forum.ts'
import { homeRoute } from '@/router/home.ts'
import { courseRoute } from '@/router/course.ts'
import { memberRoute } from '@/router/member.ts'
import { RouteRecordRaw } from 'vue-router'
import { topicRoute } from '@/router/topic.ts'

export const constantRoute: RouteRecordRaw[] = [
  {
    //登录
    path: '/login',
    component: () => import('@/views/login/index.vue'),
    name: 'login',
    meta: {
      title: '登录', //菜单标题
      hidden: true, //代表路由标题在菜单中是否隐藏  true:隐藏 false:不隐藏
    },
  },
  {
    path: '/reg',
    component: () => import('@/views/login/index.vue'),
    name: 'reg',
    meta: {
      title: '注册', //菜单标题
      hidden: true, //代表路由标题在菜单中是否隐藏  true:隐藏 false:不隐藏
    },
  },
  {
    //登录成功以后展示数据的路由
    path: '/',
    component: () => import('@/views/layout/index.vue'),
    name: 'layout',
    meta: { title: '' },
    redirect: '/home',
    children: [...homeRoute, ...mallRoute, ...forumRoute, ...courseRoute],
  },
  ...memberRoute,
  ...topicRoute,
  {
    //404
    path: '/404',
    component: () => import('@/views/404/index.vue'),
    name: '404',
    meta: {
      title: '404',
      hidden: true,
      icon: 'DocumentDelete',
    },
  },
]

//异步路由
export const asnycRoute = []

//任意路由
export const anyRoute = {
  //任意路由
  path: '/:pathMatch(.*)*',
  redirect: '/404',
  name: 'Any',
  meta: {
    title: '任意路由',
    hidden: true,
    icon: 'DataLine',
  },
}
